package com.jeff.android.lab.architecture.mvp;

import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.jeff.android.lab.R;
import com.jeff.android.lab.architecture.mvp.base.BaseMvpFragment;

import butterknife.BindView;
import butterknife.OnClick;

public class LoginFragment extends BaseMvpFragment<LoginPresenter> implements LoginContract.IView{

    @BindView(R.id.tv_login_state)
    TextView tv_login_state;
    @BindView(R.id.progressBar)
    ProgressBar mProgressBar;

    @Override
    protected int getRootLayout() {
        return R.layout.architecture_mvp_login_fragment;
    }

    @Override
    protected void initView() {
        mPresenter = new LoginPresenter();
        mPresenter.attachView(this);
    }

    @Override
    public void setLoginState() {
        tv_login_state.setText("已登录");
    }

    @OnClick({R.id.btn_login})
    public void login() {
        mPresenter.login();
    }

    @Override
    public void showLoading() {
        mProgressBar.setVisibility(View.VISIBLE);
    }

    @Override
    public void hideLoading() {
        mProgressBar.setVisibility(View.GONE);
    }

}
